home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / EGAVGA.SWG / 0137_New ANIVGA Fade - Horizontal.pas < prev    next >
Pascal/Delphi Source File  |  1995-03-03  |  2KB  |  83 lines

  1. {
  2.   Well,  some  guy from Scotland asked me if it is possible to do a fade
  3.   in  AniVGA  V1.2  which  shoves in one half of a picture from the left
  4.   side and the other half from the right side.
  5.   As it was very easy to do so and the results indeed look GREAT, it may
  6.   be  of  some interest for others, too, so here we go: You may add this
  7.   routine    to    the    other    fades   as   usual;   I   called   it
  8.   "Fade_HorizontalSplitClose  =  30;" Hopefully, I didn't mess things up
  9.   by converting the example back to TP 6.0 & AniVGA V1.2 ...
  10.  
  11. kai.rohrbacher@logo.ka.sub.org
  12. }
  13.  
  14. {$A+,B-,D+,L+,N-,E-,O-,R-,S-,V-,G-,F-,I-,X+}
  15. {$M 32768,0,655360}
  16. PROGRAM Example8D;
  17. USES ANIVGA;
  18.  
  19. CONST pic='DOG1.PIC';      {or any other PIC}
  20.       picPal1='DOG1.PAL';
  21. {$IFDEF VER60}
  22.       Seg0040:WORD=$40;
  23. {$ENDIF}
  24.  
  25.   PROCEDURE HorizontalSplitClose(pa,time:WORD);
  26.   { in: pa    = page, which contents will be made visible }
  27.   {     time  = time (in milliseconds) for this action (approx.) }
  28.   {out: - }
  29.   {rem: the contents of page "pa" has been copied to page visualPage }
  30.   CONST n = (XMAX+1) DIV 2; {number of executions of the delay loop}
  31.   VAR counter:WORD;
  32.       ClockTicks:^LONGINT; {LONGINT ABSOLUTE $40:$6C geht nicht}
  33.       t: LONGINT;
  34.       temp:REAL;
  35.       mitte,columns:INTEGER;
  36.  
  37.       p:POINTER;
  38.  
  39.   BEGIN
  40.    ClockTicks:=Ptr(Seg0040,$6C);
  41.    t := ClockTicks^;
  42.    counter := 0;
  43.    temp := 0.0182*time/n;
  44.  
  45.    mitte:=XMAX SHR 1;
  46.    FOR columns:=0 TO mitte DO
  47.     BEGIN
  48.      p:= GetImage(StartVirtualX+mitte-columns,StartVirtualY,
  49.                   StartVirtualX+mitte,StartVirtualY+YMAX,pa);
  50.      PutImage(StartVirtualX,StartVirtualY,p,1-Page);
  51.      FreeImageMem(p);
  52.  
  53.      p:= GetImage(StartVirtualX+mitte+1,StartVirtualY,
  54.                   StartVirtualX+mitte+1+columns,StartVirtualY+YMAX,pa);
  55.      PutImage(StartVirtualX+XMAX-columns,StartVirtualY,p,1-Page);
  56.      FreeImageMem(p);
  57.  
  58.      INC(counter);
  59.      WHILE (ClockTicks^ < (t+counter*temp)) DO BEGIN END;
  60.     END;
  61.  
  62.    {Cleanup:}
  63.    (* IF Odd(XMAX+1)
  64.        THEN CopyPage(pa,visualPage); *)
  65.   END;
  66.  
  67. VAR pal1:Palette;
  68.     i:WORD;
  69. BEGIN
  70.  InitGraph;
  71.  StartVirtualX:=20; StartVirtualY:=10;
  72.  LoadBackgroundPage(pic);
  73.  LoadPalette(picPal1,0,pal1); SetPalette(pal1,FALSE);
  74.  FillPage(1-Page,0);
  75.  FOR i:=1 TO 20000 DO
  76.   PutPixel(Random(Succ(XMAX)),Random(Succ(YMAX)),Random(256));
  77.  
  78.  HorizontalSplitClose(BACKGNDPAGE,2000);
  79.  
  80.  CloseRoutines;
  81. END.
  82.  
  83.